package com.wwg.myapplication;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.wwg.myapplication.R;

public class RippleActivity extends AppCompatActivity {

    private WaterRippleView rippleView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // 隐藏标题栏和状态栏，实现全屏效果
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN
        );

        // 设置布局
        setContentView(R.layout.activity_ripple);

        // 获取视图引用
        rippleView = findViewById(R.id.rippleView);
        Button closeButton = findViewById(R.id.closeButton);

        // 设置关闭按钮点击事件
        closeButton.setOnClickListener(v -> finish());
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        // 停止自动生成涟漪，释放资源
        if (rippleView != null) {
            rippleView.setAutoGenerate(false);
        }
    }
}
    